<template>
  <div class="el-sidebar">
    <el-menu
      :default-active="$route ? $route.path : '2'"
      :router="true"
      class="el-menu-vertical-hr"
      :collapse="collapse"
    >
    <MenuTree :menu-list="data" @select="onSelect"></MenuTree>
    </el-menu>
  </div>
</template>

<script>
import MenuTree from './MenuTree.vue';
export default {
  name: 'PcSidebar',
  components: { MenuTree },
  props: {
    data: {
      type: Array,
      default: () => []
    },
    collapse: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {

    };
  },
  methods: {
    onSelect(menu) {
      this.$emit('select', menu);
    }
  }
};
</script>